<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragment :: myhead(~{::title},~{})">
    <title >测试分页</title>
</head>
<body>
<table class="layui-table" lay-even lay-skin="line">
    <colgroup>
        <col width="150">
        <col width="200">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>账号</th>
        <th>姓名</th>
        <th>出生日期</th>
    </tr>
    </thead>
    <tbody id="table1" class="testclass"></tbody>
</table>
<div id="page1"></div>

<table class="layui-table" lay-even lay-skin="line">
    <colgroup>
        <col width="150">
        <col width="200">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>账号</th>
        <th>姓名</th>
        <th>出生日期</th>
    </tr>
    </thead>
    <tbody id="table2" class="testclass"></tbody>
</table>
<div id="page2"></div>
<script type="text/javascript">
    layui.config({
        base: ctx + 'js/plugin/'
    }).use(['layer', 'form','element','jquery','mypage','utils'], function(){
        layui.layer;
        layui.form;
        layui.element;
        var $ = layui.jquery;
        var mypage = layui.mypage;
        var utils = layui.utils;

        var rowsFunc = function(ds){
            var rows = "";
            $(ds).each(function (n,r) {
                rows += "<tr><td>"+r.code+"</td>";
                rows += "<td>"+r.name+"</td>";
                rows += "<td>"+utils.tsToDate(r.birth)+"</td></tr>";
            });
            return rows;
        };

        mypage.page1(ctx+'user/list',rowsFunc,{
            tableId:'table1',
            pageId:'page1',
            groups:3
        });

        mypage.page2(ctx+'user/list',rowsFunc,'table2','page2',1,2);

    });
</script>

</body>
</html>